<template>
  <view
    :class="{ popupShow: zujianxianshi }"
    @touchmove.stop.prevent="() => {}"
  >
    <!-- 招聘者 -->
    <view class="mytop">
      <view class="mytopright">
        <view class="qiyemingcheng" @click="switchIdentity">
          <view class="qiyename">
            {{ CorpFullName }}
          </view>
          <image src="/static/image/my/xiala.png" class="imgaee"></image>
        </view>
        <view class="tubiao">
          <image
            src="/static/image/payicon/saoma.png"
            @click="scanCode"
            class="imge"
          ></image>
          <image
            src="/static/image/my/qh1.png"
            @click="qiehuangeren"
            class="imge"
          ></image>
        </view>
      </view>
      <view class="JobBox">
        <view class="mytopnrtext">
          <view class="mytoxiang" @click="imageclick">
            <u-avatar
              :src="URL + UserInfo.HeadIcon"
              shape="circle"
              :size="54"
            ></u-avatar>
            <!-- <image src="/static/image/my/txx.png" class="imgestox"></image> -->
          </view>

          <view>
            <view class="fl-t">
              <text class="mytopnrtext_name">
                {{ UserInfo.RealName ? UserInfo.RealName : UserInfo.UserName }}
              </text>
              <text class="textzcr"> HR </text>
              <image
                src="/static/image/my/zpvip.png"
                v-if="list.HasVip"
                class="imgee"
              ></image>
            </view>
            <view
              class="fl-t"
              style="padding-top: 20rpx"
              @click="
                tiaozhaun(
                  '/pages/views/packageB/type-recruit/jibenshezhi/index'
                )
              "
            >
              <text class="edit">企业主页 ></text>
            </view>
          </view>
        </view>
        <view class="yaoqingCla">
          <view
            class="yaoqingimgCla"
            @click="
              tiaozhaun('/pages/views/packageB/type-recruit/invite/index')
            "
          >
            邀请加入
          </view>
        </view>
      </view>
    </view>
    <view class="mycenter">
      <view class="fl-c-c" @click="handleGoutong">
        <view class="name">沟通过</view>
        <view class="num fl-c">{{ lsitResult.JobRecordCount }}</view>
      </view>
      <view class="fl-c-c" @click="ResumeSubmitted">
        <view class="name">感兴趣</view>
        <view class="num fl-c">{{ lsitResult.ResumeCollectionCount }}</view>
      </view>
      <view class="fl-c-c" @click="interview">
        <view class="name">待面试</view>
        <view class="num fl-c">{{ lsitResult.InterviewCount }}</view>
      </view>
      <view class="fl-c-c" @click="beInterested">
        <view class="name">招聘中</view>
        <view class="num fl-c">{{ lsitResult.JobCount }}</view>
      </view>
    </view>
    <view class="sjvipBtn">
      <view class="shengjibg">
        <view class="shengjileft">
          <view class="viptext">
            <image src="/static/image/my/vip.png" class="vipimge"></image>
            <text>升级VIP</text>
          </view>
          <view class="vipjieshao"> 畅享会员权益 </view>
        </view>
        <view @click="goBuyVip" class="btn">
          <text>{{ list.HasVip ? "续费" : "去升级" }}</text>
        </view>
      </view>
    </view>
    <view class="mytext">
      <view class="mytextnrtop2">
        <u-cell
          title="权益加量包"
          isLink
          :border="true"
          @click="OnlineResume(6)"
        >
          <template slot="icon">
            <view>
              <image
                src="/static/image/my/quanyibao.png"
                class="imges_all"
              ></image>
            </view>
          </template>
        </u-cell>
        <u-cell title="面试管理" isLink :border="true" @click="OnlineResume(2)">
          <template slot="icon">
            <view>
              <image src="/static/image/my/fj.png" class="imges_all"></image>
            </view>
          </template>
        </u-cell>
        <!-- <u-cell title="专场招聘" isLink :border="true" @click="OnlineResume(3)">
					<template slot="icon">
						<view>
							<image src="/static/image/my/zfj.png" class="imges_all"></image>
						</view>
					</template>
				</u-cell> -->
        <u-cell title="反馈问题" isLink :border="true" @click="OnlineResume(4)">
          <template slot="icon">
            <view>
              <image src="/static/image/my/fkwt.png" class="imges_all"></image>
            </view>
          </template>
        </u-cell>

        <u-cell title="基本设置" isLink :border="true" @click="OnlineResume(5)">
          <template slot="icon">
            <view>
              <image src="/static/image/my/sz.png" class="imges_all"></image>
            </view>
          </template>
        </u-cell>
      </view>
    </view>

    <u-popup :show="zujianxianshi" :mode="mode" round="10" @close="close">
      <view class="upopup">
        <view class="upopuptop">选择企业</view>
        <scroll-view scroll-y class="upopupnr">
          <view
            class="upopupnrtext"
            v-for="(item, key) in promptDatalist"
            :key="key"
            @click="clicklist(item)"
          >
            <image :src="URL + item.LogoPath" class="imgestext"></image>
            <text class="nartext">{{ item.FullName }}</text>
            <!-- <text v-show="item.Status==1" class="status1">已认证</text>
						<text v-show="item.Status==0" class="status2">未认证</text> -->
            <image
              v-show="item.Status == 1"
              src="/static/recruit/index/yrz.png"
              class="imgrz"
            ></image>
            <image
              v-show="item.Status == 0"
              src="/static/recruit/index/rzz.png"
              class="imgrz"
            ></image>
            <image
              v-show="item.Status == 2"
              src="/static/recruit/index/rzsb.png"
              class="imgrz"
            ></image>
          </view>
        </scroll-view>
        <view class="but">
          <text @click="clicklist('add')" class="upopupnrbut">创建新企业</text>
        </view>
      </view>
    </u-popup>
  </view>
</template>

<script>
export default {
  props: {
    UserInfo: {
      type: Object,
    },
    lsitResult: {
      type: Object,
    },
    promptDatalist: {
      type: Array,
    },

    UserExtendInfo: {
      type: Object,
    },
    CorpFullName: {
      type: String,
    },
  },
  data() {
    return {
      type: uni.getStorageSync("type"),
      URL: this.$config.domain.staticUrl,
      list: null,
      mode: "bottom",
      zujianxianshi: false,
    };
  },
  components: {},

  created() {
    this.list = uni.getStorageSync("dianjiqiye");
  },
  computed: {},

  methods: {
    handleGoutong() {
      uni.navigateTo({
        url: "/pages/views/packageB/type-recruit/goutongguo",
      });
    },
    ResumeSubmitted() {
      uni.navigateTo({
        url: "/pages/views/packageB/type-recruit/ganxingqu",
      });
    },
    beInterested() {
      uni.navigateTo({
        url: "/pages/views/packageC/type-recruit/index?type=1",
      });
    },
    interview() {
      uni.navigateTo({
        url: "/pages/views/packageB/type-recruit/daimianshi?type=1",
      });
    },

    imageclick() {
      uni.navigateTo({
        url: "/pages/views/packageB/type-jobhunting/jibenshezhi/jibenziliao/index",
      });
    },
    clicklist(e) {
      console.log(e);
      const app = getApp();
      if (!e) {
        this.$emit("clicklist");

        return;
      } else if (e == "add") {
        if (this.UserInfo.Status === 0 || this.UserInfo.Status === 2) {
          uni.navigateTo({
            url: "/pages/views/packageB/type-jobhunting/jibenshezhi/jibenziliao/shimingrenzheng",
          });
          this.close();
        } else {
          uni.navigateTo({
            url: "/pages/views/packageB/type-recruit/jibenshezhi/renzhen/qiyei_renzheng",
          });
          this.close();
        }
      } else if (e.Status === 0 || e.Status === 2) {
        uni.navigateTo({
          url:
            "/pages/views/packageB/type-recruit/jibenshezhi/renzhen/qiyei_renzheng?ids=" +
            e.Id,
        });
        this.close();
      } else if (e.Id == app.globalData.userCorpId) {
        this.$util.toast("您已在当前公司");
      } else {
        console.log("1111");
        this.qihuanjushe(e.Id);
        this.close();
      }
    },
    // 扫码登录
    scanCode() {
      this.$emit("ClickscanCode");
    },
    close() {
      this.zujianxianshi = false;
    },

    switchIdentity() {
      this.zujianxianshi = true;
    },
    qiehuangeren() {
      uni.navigateTo({
        url: "/pages/My/JumpPage?type=" + this.type,
      });
    },

    tiaozhaun(e) {
      uni.navigateTo({
        url: e,
      });
    },
    // 购买VIP
    goBuyVip() {
      let HasVip = this.UserInfo.HasVip;
      uni.navigateTo({
        url:
          "/pages/views/packageB/type-jobhunting/upgradevip/upgradevip?HasVip=" +
          HasVip,
      });
    },
    OnlineResume(type) {
      if (type == 2) {
        uni.navigateTo({
          url: "/pages/views/packageB/type-recruit/miashi/miashilist",
        });
      }
      // else if (type == 3) {
      // 	uni.navigateTo({
      // 		url: '/pages/views/packageB/type-jobhunting/jobIntention'
      // 	})
      // }
      else if (type == 4) {
        uni.navigateTo({
          url: "/pages/views/packageB/type-jobhunting/feedback/feedback",
        });
      } else if (type == 5) {
        uni.navigateTo({
          url: "/pages/views/packageB/type-recruit/jibenshezhi/jibenshezhi",
        });
      } else if (type == 6) {
        uni.navigateTo({
          url: "/pages/views/packageB/type-recruit/BenefitPackage/benefitPackage",
        });
      }
    },
    // 切换公司
    qihuanjushe(itemid) {
      let that = this;

      let obj = {
        CurrentRole: "",
        CurrentCorpId: "",
      };
      if (itemid) {
        //招聘者
        obj = {
          CurrentRole: 1,
          CurrentCorpId: itemid,
        };
      }
      // else {
      //   // 切换成 个人
      //   obj = {
      //     CurrentRole: 0,
      //     CurrentCorpId: null
      //   }
      // }
      console.log("obj", obj);
      // 当前角色 0求职者 1招聘者

      this.$http.core.changCurrentRole(obj).then(async (res) => {
        if (res.Success) {
          // //tim退出登录
          await this.$util.timlogout();
          this.$util.currentUser().then(() => {
            this.$util.setCustomTabbar();
            uni.reLaunch({
              url: "/pages/entry/index",
            });
          });
        }
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.mytop {
  background-image: url("/static/image/payicon/back.png");
  background-repeat: no-repeat;
  background-size: cover;
  width: 100%;
  height: 379rpx;

  .mytopright {
    width: 100%;
    padding-top: 116rpx;
    display: flex;
    flex-direction: row;
    justify-content: space-between;

    .qiyemingcheng {
      padding: 0 40rpx;
      display: flex;
      align-items: center;

      .qiyename {
        padding-right: 10rpx;
        font-size: 32rpx;
        font-weight: bold;
      }

      .imgaee {
        width: 20rpx;
        height: 12rpx;
      }
    }

    .tubiao {
      .imge {
        width: 38rpx;
        height: 38rpx;
        margin-left: 10rpx;
        margin-right: 30rpx;
      }
    }
  }

  .JobBox {
    margin: 40rpx 0 0 40rpx;
    display: flex;
    align-items: center;
    justify-content: space-between;

    .mytopnrtext {
      display: flex;
      align-items: center;

      .mytopnrtext_name {
        font-size: 42rpx;
        font-weight: bold;
      }

      .textzcr {
        font-size: 24rpx;
        font-weight: 400;
        color: #476df0;
        padding: 4rpx 17rpx;
        margin-left: 20rpx;
        border-radius: 10rpx;
        border: 1px solid #476df0;
      }

      .imgee {
        width: 76rpx;
        height: 24rpx;
        margin-left: 21rpx;
      }

      .edit {
        color: #8f93a0;
        font-size: 30rpx;
      }

      .editimg {
        margin-left: 20rpx;
        width: 25rpx;
        height: 25rpx;
      }

      .mytoxiang {
        position: relative;
        margin-right: 20rpx;

        .imgestox {
          width: 32rpx;
          height: 32rpx;
          position: absolute;
          top: 80rpx;
        }
      }
    }

    .yaoqingCla {
      display: flex;
      align-items: center;
      justify-content: end;

      .yaoqingimgCla {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 165rpx;
        height: 64rpx;
        background: linear-gradient(130deg, #fce5d9 0%, #f6c6ab 100%);
        border-radius: 50rpx 0rpx 0rpx 50rpx;
        border: 2rpx solid #ffffff;
        font-weight: 400;
        color: #662009;
        font-size: 28rpx;
      }
    }
  }

  // .mytopcenter{
  // 	display: flex;
  // 	margin-top: 42rpx;
  // 	.mytopcenterimg{
  // 		margin: 0 0 0 40rpx;
  // 		image{
  // 			border-radius: 100rpx;
  // 			width: 108rpx;
  // 			height: 108rpx;
  // 		}
  // 	}
  // 	.mytopcentertext{
  // 		width: 256rpx;
  // 		display: flex;
  // 		flex-direction: column;
  // 		justify-content: center;
  // 		margin-left: 20rpx;
  // 		.mytopcentertexttop{
  // 			display: flex;
  // 			margin-bottom: 20rpx;
  // 			.mytopcentertextname{
  // 				font-size: 50rpx;
  // 				font-weight: bold;
  // 				margin-right: 20rpx;
  // 			}
  // 			.textzcr {
  // 			  font-size: 22rpx;
  // 			  font-weight: 500;
  // 			  color: #476df0;
  // 			  padding: 5rpx 20rpx;
  // 			  margin-left: 30rpx;
  // 			  border-radius: 10rpx;
  // 			  border: 1px solid #476df0;
  // 			}

  // 		}
  // 		.mytopcenterhome{
  // 			font-size: 26rpx;
  // 			color: #666666;
  // 			margin-top: 6rpx;
  // 		}
  // 	}
  // 	.yaoqingCla{
  // 		width: 44%;
  // 		display: flex;
  // 		align-items: center;
  // 		justify-content: end;
  // 		.yaoqingimgCla{
  // 			display: flex;
  // 			justify-content: center;
  // 			align-items: center;
  // 			width: 165rpx;
  // 			height: 64rpx;
  // 			background: linear-gradient(130deg, #FCE5D9 0%, #F6C6AB 100%);
  // 			border-radius: 50rpx 0rpx 0rpx 50rpx;
  // 			opacity: 0.34;
  // 			border: 2rpx solid #FFFFFF;
  // 			font-weight: 800;
  // 			color: #662009;
  // 			font-size: 28rpx;
  // 		}
  // 	}
  // }
}

.mycenter {
  width: 100%;
  display: flex;
  justify-content: space-around;

  .num {
    margin-top: 20rpx;
    font-size: 36rpx;
    font-weight: bold;
    color: #000000;
  }

  .name {
    font-size: 24rpx;
    font-weight: 500;
    color: #8f93a0;
  }
}

.sjvipBtn {
  padding: 20rpx 30rpx;

  .shengjibg {
    background-image: url("@/static/image/my/vipbg.png");
    background-repeat: no-repeat;
    background-size: cover;
    display: flex;
    border-radius: 20rpx 20rpx 20rpx 20rpx;
    display: flex;
    justify-content: space-between;
    padding: 10px 20px;
    align-items: center;

    .shengjileft {
      .viptext {
        padding: 10rpx 0;

        .vipimge {
          width: 27.8rpx;
          height: 24rpx;
          margin-right: 9rpx;
        }

        text {
          font-size: 30rpx;
          font-weight: bold;
          color: #f5c1a5;
        }
      }

      .vipjieshao {
        font-size: 24rpx;
        font-weight: 400;
        color: #8c95b5;
        padding: 10rpx 0;
      }
    }

    .btn {
      background: linear-gradient(90deg, #feede5 0%, #f5c4a9 100%);
      border-radius: 31rpx 31rpx 31rpx 31rpx;
      opacity: 1;
      text-align: center;

      text {
        font-size: 24rpx;
        font-weight: bold;
        color: #563726;
        padding: 15rpx 30rpx;
        display: flex;
        justify-content: center;
        flex-direction: column;
        align-items: center;
      }
    }
  }
}

.mytext {
  padding: 10rpx 30rpx;

  .mytextnrtop2 {
    border-radius: 20rpx;
    background-color: #ffffff;

    .imges_all {
      width: 29rpx;
      height: 26rpx;
      margin-right: 30rpx;
    }

    /deep/.u-icon__icon {
      font-size: 12px !important;
    }
  }
}

.upopup {
  padding: 20rpx 50rpx;
  // width: 600rpx;
  text-align: center;

  .upopuptop {
    padding: 20rpx;
    font-size: 36rpx;
  }

  .upopupnr {
    margin: 20rpx 0rpx 30rpx;
    height: 300rpx;
    overflow-y: auto;

    .upopupnrtext {
      padding: 10rpx 40rpx;
      display: flex;
      justify-content: inherit;
      align-items: center;

      .imgestext {
        width: 40rpx;
        height: 40rpx;
      }

      .nartext {
        padding: 10rpx 20rpx;
        font-size: 34rpx;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        width: 64%;
        text-align: left;
      }

      .status1 {
        color: #165dff;
        border-radius: 10rpx;
        padding: 5rpx 20rpx;
        font-size: 24rpx;
        background-color: #f2f2f2;
      }

      .status2 {
        color: #00000085;
        border-radius: 10rpx;
        padding: 5rpx 20rpx;
        font-size: 24rpx;
        background-color: #f2f2f2;
      }

      .imgrz {
        width: 108rpx;
        height: 32rpx;
      }
    }
  }

  .but {
    .upopupnrbut {
      padding: 24rpx 32rpx;
      background-color: #1684fc;
      border-radius: 10rpx;
      color: #ffffff;
      display: inline-block;
      width: 90%;
    }
  }
}

.popupShow {
  // overflow: hidden;
  position: fixed;
  height: 100vh;
  width: 100%;
}
</style>